function goHome(){
	window.location.href=baseUrl+"index.html";
}

function goWebMap(){
	window.location.href=baseUrl+"map.php";
}

function setHome(obj) {
	try {
		obj.style.behavior = 'url(#default#homepage)';
		obj.setHomePage(baseUrl);
	} catch (e) {
		if (window.netscape) {
			try {
				netscape.security.PrivilegeManager
						.enablePrivilege("UniversalXPConnect");
			} catch (e) {
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',再进行操作.");
			}
		}
	}
}

function addFavorite(){
	try{
	    window.external.addFavorite(baseUrl,webTitle);
	}catch(exception){
		try{
			window.sidebar.addPanel(webTitle, baseUrl, "");
		}catch(ex){
			alert("Add to favorite fail,please use the Ctrl+D!");
		}
	}
}

function visitUrl(){
	var user = new userClass();
	user.init();
}

function fCopyToClicp(id){
	var a = document.getElementById(id);
	window.clipboardData.setData('text',a.value);
	alert("已复制到剪贴板了.");
}

//=======================================================================
var userClass = function(){
	this.user = null;
	this.userNode = $("div[id=header] > div[class=user]");

	this.init = function(self){
		self.userNode.children().hide();
		self.userNode.addClass("loading");
		userInfo.find(function(data){
		    self.user = data;
		    self.load(self);
		});
	};
	
	this.load=function(self){
		var userHead = self.userNode.find($("div[class=head] > img"));
		userHead[0].src=self.user.headImgSrc;

	  	var userInfo = self.userNode.find($("div[class=info] > div"));
	  	$(userInfo[0]).text(self.user.name);
	  	$(userInfo[1]).text("Level : "+self.user.level);
	  	$(userInfo[2]).text(self.user.sign);

		this.userNode.removeClass("loading");
		this.userNode.children().show();
	};
};

function getParamValue(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}

$(document).ready(function() {
    var user = new userClass();
    user.init(user);
});